package com.sihan.framework.etm.vo;

import com.sihan.framework.etm.common.util.DateUtils;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class ToolIocationMode implements Serializable {

    private static final long serialVersionUID = -7971882839131925146L;

    //设备编号
    private String id;
    private String toolId;
    //设备类型
    // 米级定位：type=6001;
    //分米级定位：type=6002;
    //安全帽：type=6003;
    //警示牌：type=6004;
    private String type;
    //日期
    private String date;
    //天数
    private String time;
    //海拔高度
    private String height;
    //经度
    private String longitude;
    //维度
    private String latitude;
    //地面航率
    private String speed;
    //地面航向
    private String direction;
    //电池电压
    private String voltage;
    //芯片温度
    private String temperature;
    //A项id
    private String a;
    //B项id
    private String b;
    //C项id
    private String c;
    //定位精度
    private String precision;
    //使用卫星数
    private String satellite;
    //发送次数
    private String count;
    //近电状态
    private String alarm;


    //大地水准面高度
    private String geo_sep;

    //接地1
    private String d1;
    //接地2
    private String d2;
    //接地3
    private String d3;


    public String toStr(Date date) {

        if ("4001".equals(this.type)) {
            return "start;"
                    + this.type + ";"
                    + this.id + ";"
                    + DateUtils.getInstance().getDateStr(date, DateUtils.getInstance().SDF_YM_DD4) + ";"
                    + DateUtils.getInstance().getDateStr(date, DateUtils.getInstance().SDF_HH_MM_SS) + ";"
                    + this.height + ";"
                    + this.geo_sep + ";"
                    + this.longitude + ";"
                    + this.latitude + ";"
                    + this.speed + ";"
                    + this.direction + ";"
                    + this.voltage + ";"
                    + this.temperature + ";"
                    + this.a + ";"
                    + this.b + ";"
                    + this.c + ";"
                    + this.d1 + ";"
                    + this.d2 + ";"
                    + this.d3 + ";"
                    + this.precision + ";"
                    + this.satellite + ";"
                    + this.count + ";"
                    + this.alarm + ";"
                    + "end";
        } else {
            return "start;"
                    + this.type + ";"
                    + this.id + ";"
                    + DateUtils.getInstance().getDateStr(date, DateUtils.getInstance().SDF_YM_DD4) + ";"
                    + DateUtils.getInstance().getDateStr(date, DateUtils.getInstance().SDF_HH_MM_SS) + ";"
                    + this.height + ";"
                    + this.longitude + ";"
                    + this.latitude + ";"
                    + this.speed + ";"
                    + this.direction + ";"
                    + this.voltage + ";"
                    + this.temperature + ";"
                    + this.a + ";"
                    + this.b + ";"
                    + this.c + ";"
                    + this.precision + ";"
                    + this.satellite + ";"
                    + this.count + ";"
                    + this.alarm + ";"
                    + "end";
        }
    }

}
